#!/bin/sh

# In pre-commit, PWD is set to the root of the repo
# https://longair.net/blog/2011/04/09/missing-git-hooks-documentation/
ROOT_DIR="$PWD"

# If any README file has been changed, update the website
git status -s | grep '  README\|  readme\|  build-website.js' > /dev/null 2>&1
readmeStatus=$?
if [ $readmeStatus -eq 0 ]; then
	node "$ROOT_DIR/Tools/build-website.js"
	git add docs
fi